package com.jstnvr.smartcampus.controller;

import com.jstnvr.smartcampus.entity.CheckMobileCode;
import com.jstnvr.smartcampus.pojo.LoginCheck;
import com.jstnvr.smartcampus.pojo.R;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.concurrent.TimeUnit;

@Controller

public class FaceuserController {





    private Logger logger = LoggerFactory.getLogger(this.getClass().getName());


    @RequestMapping("/userDo/login")
    public String toLoginPage(){
        return "user/login";
    }


    @RequestMapping("/userDo/addFace")
    public String toAddFace(){
        return "user/addface";
    }




    /**
     * 获取手机验证码 6位
     *
     * @param mobileCode 请求的参数
     * @return 处理结果
     */
    @RequestMapping("/userDo/getCheckCode.do")
    @ResponseBody
    public R getCheckCode(@RequestBody CheckMobileCode mobileCode) {

        //CheckMobileCode mobileCode = JSON.parseObject(smsReceiptJSON, CheckMobileCode.class);//将数据转换为对象
        logger.info("==>收到数据：" + mobileCode.toString());
        String mobile = mobileCode.getUsername();//这是电话号码
        long dateTime = mobileCode.getDateTime();//这是上传的时间戳



        return R.ok();

        //测试使用,使用error方法才能带回生成的验证码
        //return R.error(200, checkCode + "");
    }


    @RequestMapping(value = "/ajaxBind.do", method = RequestMethod.POST)
    @ResponseBody
    public String ajaxBind(@RequestBody LoginCheck loginCheck) {//springMVC会自动进行json转换


        logger.info("收到数据"+loginCheck.toString());

        return "1";

    }





}
